package com.bank.backend.boot.server.controller;

import com.bank.backend.boot.server.annotation.ResponseResult;
import com.bank.backend.boot.server.kafka.ProducerKafka;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author jiaowei
 * @since 2025/3/31 23:25
 */
@Slf4j
@Tag(name = "kafka")
@RestController
@RequestMapping("/kafka")
public class KafkaController {
    @Resource
    private ProducerKafka producerKafka;

    @Operation(summary = "发送消息")
    @GetMapping("/send/{message}")
    @ResponseResult
    public void send(@PathVariable("message") String message) {
        producerKafka.send("bank-backend-trade", message);
    }
}
